{php include wl_template('common/header');}
<style>
	.prstyle{color: orangered;}
</style>
<ul class="nav nav-tabs">
	<li {if empty($_GPC['status'])} class="active" {/if}><a href="{php echo web_url('wlfightgroup/fightorder/grouplist')}">全部团<span class="label label-warning pull-right" style="margin-left: 10px;">{$status0}</span></a></li>
	<li {if $_GPC['status'] == 1} class="active" {/if}><a href="{php echo web_url('wlfightgroup/fightorder/grouplist',array('status'=>1))}">组团中<span class="label label-warning pull-right" style="margin-left: 10px;">{$status1}</span></a></li>
	<li {if $_GPC['status'] == 2} class="active" {/if}><a href="{php echo web_url('wlfightgroup/fightorder/grouplist',array('status'=>2))}">组团成功<span class="label label-warning pull-right" style="margin-left: 10px;">{$status2}</span></a></li>
	<li {if $_GPC['status'] == 3} class="active" {/if}><a href="{php echo web_url('wlfightgroup/fightorder/grouplist',array('status'=>3))}">组团失败<span class="label label-warning pull-right" style="margin-left: 10px;">{$status3}</span></a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{MODULE_NAME}" />
				<input type="hidden" name="p" value="wlfightgroup" />
				<input type="hidden" name="ac" value="fightorder" />
				<input type="hidden" name="do" value="grouplist" />
				
				
				<div class="form-group">
					<label class="col-sm-2 control-label">关键字</label>
					<div class="col-md-3">
						<select name="keywordtype" class="form-control">
							<option value="">关键字类型</option>
							<option value="1" {if $_GPC['keywordtype']==1}selected="selected"{/if}>商品ID</option>
							<option value="2" {if $_GPC['keywordtype']==2}selected="selected"{/if}>商家ID</option>
							<option value="3" {if $_GPC['keywordtype']==3}selected="selected"{/if}>商品名称</option>
							<option value="4" {if $_GPC['keywordtype']==4}selected="selected"{/if}>商家名称</option>
						</select>
                    </div>
                    <div class="col-md-4">
                        <input type="text" name="keyword" class="form-control" value="{$_GPC['keyword']}"  placeholder="请输入关键字"/>
                    </div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">时间</label>
					<div class="col-md-3">
						{php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));}
					</div>
				</div>	
			 	<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<button class="btn btn-primary" id="search">筛选</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="app-table-list">
		<div class="table-responsive">
			<table id="de1" class="table table-hover table-bordered">
				<thead>
				<tr>
					<th class="text-center" style="width:30px;">序号</th>
					<th class="text-center" style="width:200px;">商品</th>
					<th class="text-center" style="width:150px;">所属商家</th>
					<th class="text-center" style="width:100px;">开始时间</th>
					<th class="text-center" style="width:90px;">人数(已有/总需)</th>
					<th class="text-center" style="width:60px;">状态</th>
					<th class="text-center" style="width:70px;">操作</th>
				</tr>
				</thead>
				<tbody>
				{loop $list $k $item}
				<tr class="text-center" >
					<td>
						<center>{php echo $k+1}</center>
					</td>
					<!--商品-->
					<td>
						<div class="img" style="text-align: left;padding-left: .3rem;">
							<img style="height: 5rem;width: 5rem;" class="scrollLoading" src="{IMAGE_PIXEL}" data-url="{php echo tomedia($item['logo'])}">
							<span> {$item['name']}</span>
						</div>
					</td>
					<!--所属商家-->
					<td>
						{$item['storename']}
					</td>
					<!--开始时间-->
					<td>
						{php echo date('Y-m-d',$item['starttime'])}<br />
						{php echo date('H:i:s',$item['starttime'])}
					</td>
					<!--人数-->
					<td>
						<span><span class="prstyle">{php echo $item['neednum'] - $item['lacknum']}</span>/{$item['neednum']}</span>
					</td>
					<!--状态-->
					<td>
						{if $item['status'] == 1}<span class="label label-warning">组团中</span>{/if}
						{if $item['status'] == 2}<span class="label label-success">组团成功</span>{/if}
						{if $item['status'] == 3}<span class="label label-danger">组团失败</span>{/if}
						{if $item['is_lucky'] > 0}
							<br/><br/><span class="label label-success">幸运团</span>
						{/if}
					</td>
					<!--操作-->
					<td>
						<a href="{php echo web_url('order/wlOrder/orderlist',array('plugin'=>'wlfightgroup','fightgroupid'=>$item['id']))}">查看订单</a>
						{if $item['status'] == 1}<br/><a href="javascript:;" class="fish" groupid = "{$item['id']}">手动成团</a>{/if}
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
		<div class="app-table-foot clearfix">
			<div class="pull-left">
				
			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$("#search").click(function(){
		$('#form1')[0].submit();
	});
</script>
<script>
	$('#de1').delegate('.fish','click',function(e){
		e.stopPropagation();
		var id = $(this).attr('groupid');
		util.nailConfirm(this, function(state) {
		if(!state) return;
			$.post("{php echo web_url('wlfightgroup/fightorder/fishgroup')}", { id : id }, function(data){
				if(!data.errno){
				util.tips("成团成功！");
				location.reload();
				}else{
				util.tips(data.message);	
				};
			}, 'json');
		}, {html: '确认成团?'});
	});
</script>
{php include wl_template('common/footer');}